<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    request.setAttribute("contextPath", request.getContextPath());
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>慧驾书城后台管理系统</title>
<meta name="查看port" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- Bootstrap style -->
<link id="callCss" rel="stylesheet"
	href="${contextPath }/themes/bootshop/bootstrap.min.css" media="screen" />
<link href="${contextPath }/themes/css/base.css" rel="stylesheet"
	media="screen" />
<!-- Bootstrap style responsive -->
<link href="${contextPath }/themes/css/bootstrap-responsive.min.css"
	rel="stylesheet" />
<link href="${contextPath }/themes/css/font-awesome.css"
	rel="stylesheet" type="text/css">
<!-- Google-code-prettify -->
<link href="${contextPath }/themes/js/google-code-prettify/prettify.css"
	rel="stylesheet" />
<!-- fav and touch icons -->
<link rel="shortcut icon" href="themes/images/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144"
	href="${contextPath }/themes/images/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114"
	href="${contextPath }/themes/images/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"
	href="${contextPath }/themes/images/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed"
	href="${contextPath }/themes/images/ico/apple-touch-icon-57-precomposed.png">
<style type="text/css" id="enject"></style>
</head>
<body>
	<div id="header">
		<div class="container">
			<div id="welcomeLine" class="row">
				<div class="span6">
					<c:if test="${not empty ADMIN_USER_KEY_IN_SESSION }">
						<p>尊敬的 ${adminRoleName} <font color=blue><b>${ADMIN_USER_KEY_IN_SESSION.userName }</b></font> 欢迎您!
						<strong><a href="${contextPath }/admin/adminlogout" />登出</a></strong></p>
					</c:if>

				</div>

			</div>
			<!-- Navbar ================================================== -->
			<div id="logoArea" class="navbar">
				<a id="smallScreen" data-target="#topMenu" data-toggle="collapse"
					class="btn btn-navbar"> <span class="icon-bar"></span> <span
					class="icon-bar"></span> <span class="icon-bar"></span>
				</a>
				<div class="navbar-inner">
					<a class="brand" href="index.html"><img
						src="${contextPath }/themes/images/logo.png" alt="Bootsshop" /></a>

					<h2>
						<font color=white>慧驾书城后台管理系统</font>
					</h2>
				</div>
			</div>


			<div class="navbar">
				<div class="navbar-inner">
					<div class="container">
						<a class="btn btn-navbar" data-toggle="collapse"
							data-target=".nav-collapse"> <span class="icon-bar"></span> <span
							class="icon-bar"></span> <span class="icon-bar"></span>
						</a>
 						<a class="brand" href="${contextPath }/admin">慧驾书城管理主页</a>
						<div class="nav-collapse">
							<ul class="nav">
								<li class="active"><a href="#">所有用户</a></li>
								<li><a href="${contextPath }/admin/user/add">添加用户</a></li>
							</ul>

						</div>
						<!-- /.nav-collapse -->
					</div>
				</div>
				<!-- /navbar-inner -->
			</div>
			<!-- /navbar -->

		</div>
	</div>
	<!-- Header End====================================================================== -->

	<div id="mainBody">
		<div class="container">
			<div class="row">
				<!-- Sidebar ================================================== -->

				<!-- Sidebar end=============================================== -->

	<div class="span12">
		<table class="table table-striped">
        <thead>
          <tr>
   
            <th>用户ID</th>
			<th>登录账户</th>
			<th>用户名称</th>
			<th>用户角色</th>
			<th>用户密码</th>
			<th>用户邮箱</th>
			<th>用户余额</th>
			<th>注册时间</th>
			<th width="20%">操作</th>
		
          </tr>
        </thead>
        
        
        
		
        <tbody>
         		<c:forEach items="${users }" var="u">
			<tr>
				<td>${u.userId }</td>
				<td>${u.loginName }</td>
				<td>${u.userName }</td>
				<td>${u.roleName }</td>
				<td>${u.password }</td>
				<td>${u.email }</td>
				<td>${u.account }</td>
				<td>${u.registerTime }</td>
				<td>
				    <a href="${contextPath }/admin/user/update/${u.userId }"><font color=blue>编辑</font></a>
				    &nbsp;&nbsp;
				    <a href="${contextPath }/admin/user/delete/${u.userId }"><font color=red>删除</font></a>
				    
				    
				    <c:choose>
												<c:when test="${u.roleName == '普通用户' || u.roleName == ''||u.roleName == null}">

													<%
													    request.setAttribute("userStatus", "封禁用户");
													%>
 &nbsp;&nbsp;
												<a href="${contextPath }/admin/user/userlist/${u.userId }/${userStatus}"><font color=green>封禁</font></a>

												</c:when>


												<c:when test="${u.roleName == '超级管理员' || u.roleName == '商品管理员'|| u.roleName == '用户管理员'|| u.roleName == '订单管理员'}">


												</c:when>
												<c:otherwise>
													<%
													    request.setAttribute("userStatus", "普通用户");
													%>
													 &nbsp;&nbsp;
											  <a href="${contextPath }/admin/user/userlist/${u.userId }/${userStatus}"><font color=blue>解封</font></a>

												</c:otherwise>
											</c:choose>

									



				</td>
			</tr>
		</c:forEach>
		
        </tbody>
      </table>
	</div>
	

				
	
			</div>
		</div>
	</div>
	<!-- Footer ================================================================== -->
	<div id="footerSection">
		<div class="container">

			<p class="pull-right">&copy; 慧驾书城</p>
		</div>
		<!-- Container End -->
	</div>
	<!-- Placed at the end of the document so the pages load faster ============================================= -->
	<script src="${contextPath }/themes/js/jquery.js"
		type="text/javascript"></script>
	<script src="${contextPath }/themes/js/bootstrap.min.js"
		type="text/javascript"></script>
	<script
		src="${contextPath }/themes/js/google-code-prettify/prettify.js"></script>

	<script src="${contextPath }/themes/js/bootshop.js"></script>
	<script src="${contextPath }/themes/js/jquery.lightbox-0.5.js"></script>

	<span id="themesBtn"></span>
</body>
</html>